<?php

/*

Process Get Lost Password (lost_pass.pro.php)

*/
ob_start();
$rank_check = 0;
include "global.inc.php";

$lost_username = strtolower(ereg_replace(" ", "", $lost_username));

$check = fetch("SELECT * FROM members_profiles2 WHERE username = '$lost_username' AND email = '$lost_email' AND game = '$game'");

if (!$check[id])
{
	header("Location: $base_url/lost_pass.php?game=$game&error=The+email+address+you+entered+did+not+match+the+one+you+registered+with.");
}
if ($check[id])
{
	$code = makepassword();
	mysql_query("INSERT INTO lost_passwords2 (username,code,game) VALUES ('$check[username]','$code','$game')");
	mail($check[email],"Your New $gameName2 Password","Hello, $check[username].\n\nSomebody has requested a change of password for your account. If you know your password and don't want to change it, please ignore this message. If you receive more emails, contact relientk@hotpop.com to report it. If you do need a new password, go to the following url to receive it.\n\n$base_url/get_new_password.php?game=$game&who=$check[username]&code=$code\n\nSincerely,\n\nThe $gameName2 Team","From: relientk@hotpop.com");
	header("Location: $base_url/login.php?game=$game&error=Thank+you.+To+get+your+new+password,+follow+the+directions+in+your+email.");
}

?>
